<?php
/**
 * Created by PhpStorm.
 * User: woddp
 * Date: 2017/2/12
 * Time: 2:22
 */
namespace Admin\Behaviors;
class AuthBehavior extends \Think\Behavior {

      //行为执行入口
    public function run(&$param) {
         $user_data=(auth_user());
        if(empty($user_data)&&CONTROLLER_NAME=='User'&&ACTION_NAME=="login"){
            return false;
        }
        if(!empty($user_data)&&$user_data!=null&&isset($user_data['name'])){

        }
        else{
            header("location:".U('user/login'));
        }
    }
}